package com.franklin.java.completion;


import com.franklin.plugins.common.utils.DataCheckUtils;

import java.util.*;

/**
 * @author Franklin
 * @since 2021/8/5 12:20
 */
class ContributorMap extends HashMap<CompletionOrder, List<JavaCompletionContributor>> {

    public boolean put(JavaCompletionContributor javaCompletionContributor){
        List<JavaCompletionContributor> javaCompletionContributors = get(javaCompletionContributor.getOrder());
        if (DataCheckUtils.isEmpty(javaCompletionContributors)){
            javaCompletionContributors = new ArrayList<>();
            put(javaCompletionContributor.getOrder(),javaCompletionContributors);
        }
        return javaCompletionContributors.add(javaCompletionContributor);
    }
}
